import * as _api from './api'
import request, { setAutoLog } from './request'
import { mixedRequests } from './mixed-requests'

export { ApiError } from './request'

const api = {
  ..._api,
  request,
  mixedRequests,
  xdebug(flag) {
    return request({
      url: '/api',
      method: 'get',
      params: {
        XDEBUG_SESSION_START: flag ? 1 : 0
      }
    })
  }
}

export function exportApi(autoLog = false) {
  window.api = api
  setAutoLog(autoLog)
}

export default api
